from django.template import Library
from django.urls import reverse
register = Library()


@register.inclusion_tag('manage_menu_list.html')
def manage_menu_list(request):
    data_list = [
        {'title': '首页', 'url': reverse('mac_home')},
        {'title': '生产计划', 'url': reverse('input_mac')},
        {'title': 'MAC下载', 'url': reverse('download_details')},
    ]
    for item in data_list:
        if request.path_info == item['url']:
            item['class'] = 'active'
    return {'data_list': data_list}